﻿@{
    Ajax.Dna().Widget()
        .UserPreferences(@<text>
    @{
        var _id = item.GenerateFieldID("IsProfile");
    }
    <div>
        <label for="@item.GenerateFieldID("UserName")">
            User name</label>@Html.RadioButton(item.GenerateFieldID("IsProfile"), item.GetBool("IsProfile"), item.GetBool("IsProfile"))
        <label for="@item.GenerateFieldID("SearchKey")">
            Search key</label>@Html.RadioButton(item.GenerateFieldID("IsProfile"), !item.GetBool("IsProfile"), !item.GetBool("IsProfile"))
    </div>
    <div>@Ajax.Dna().TextBox(item.GenerateFieldID("Term")).Value(item.GetString("Term")).GetHtml()</div>
    </text>)
        .Content(@<text>
    @if (!string.IsNullOrEmpty(item.GetString("Term")))
    {
        <div style="text-align: center;">
            @if (item.GetData<bool>("IsProfile"))
            {
                @Twitter.Profile(item.GetString("Term"))
            }
            else
            {
                @Twitter.Search(item.GetString("Term"))
            }
        </div>
    }
    </text>)
.Design(@<text>
    @_TwitterPreview()
    </text>)
.Preview(@<text>
    @_TwitterPreview()
    </text>)
        .Render();
}
@helper _TwitterPreview()
    {
    <link href="http://widgets.twimg.com/j/2/widget.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        #twtr-widget-1 .twtr-popular { display: inline-block; }
        #twtr-widget-1 .twtr-avatar { display: block; }
        #twtr-widget-1 .twtr-user { display: inline; }
        #twtr-widget-1 .twtr-tweet-text { margin-left: 40px; }
        #twtr-widget-1 em { display: block; }
        #twtr-widget-1 .twtr-doc, #twtr-widget-1 .twtr-hd a,</style>
    <div id="twtr-widget-1" class="twtr-widget">
        <div style="width: 250px;" class="twtr-doc">
            <div class="twtr-hd">
                <h3>
                    dotnetage</h3>
                <h4>
                    dotnetage</h4>
            </div>
            <div class="twtr-bd">
                <div style="height: 300px;" class="twtr-timeline">
                    <div class="twtr-tweets">
                        <div class="twtr-reference-tweet">
                        </div>
                        <!-- tweets show here -->
                    </div>
                </div>
            </div>
            <div class="twtr-ft">
                <div>
                    <a href="http://twitter.com" target="_blank">
                        <img src="http://widgets.twimg.com/i/widget-logo.png" alt="" /></a> <span><a href="#"
                            style="color: #FFFFFF;" class="twtr-join-conv" target="_blank">Join the conversation</a></span>
                </div>
            </div>
        </div>
    </div>
}